﻿<!DOCTYPE html>
<html ng-app="app">
	<head>
		<meta charset="utf-8">
		<script src="angular.min.js"></script>
	</head>
	<body ng-controller="CalcController">
		<div>单价：<input type="number" ng-model="price"/></div><br/>
		<div>数量：<input type="number" ng-model="num"/></div><br/>
		<div>总价：{{totalPrice()}}</div>
		<script type="text/javascript">
			function CalcController($scope){
				$scope.price = 10;
				$scope.num =1 ;
				$scope.totalPrice = function(){
					return $scope.price * $scope.num;
				}
			}
			var app = angular.module("app",[]);
			app.controller("CalcController",CalcController);
		</script>
	</body>
</html>
